home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AppsToGo / DTS.Draw / Start.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  2.8 KB  |  109 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        Start.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1989-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19.  
  20.  
  21. /*****************************************************************************/
  22.  
  23.  
  24.  
  25. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  26. #include "App.defs.h"        /* Get various application definitions.            */
  27. #include "App.protos.h"        /* Get the prototypes for application.            */
  28.  
  29. #ifndef __TOOLUTILS__
  30. #include <ToolUtils.h>
  31. #endif
  32.  
  33.  
  34.  
  35. /*****************************************************************************/
  36.  
  37.  
  38.  
  39. OSErr        DefaultPreferences(void);
  40.  
  41. short        gQuickBalloons = (shiftKey | controlKey);
  42. extern void _DataInit();
  43.  
  44.  
  45.  
  46. /*****************************************************************************/
  47. /*****************************************************************************/
  48.  
  49. #ifdef applec
  50. #pragma segment appStart
  51. #endif
  52.  
  53. /*****************************************************************************/
  54. /*****************************************************************************/
  55.  
  56.  
  57.  
  58. void    main(void)
  59. {
  60.  
  61. #ifdef applec
  62.     UnloadSeg((Ptr)_DataInit);        /* Note that _DataInit can't be in Main! */
  63. #endif
  64.  
  65.     SetApplLimit(GetApplLimit() - 16384);
  66.         /* This decreases the application heap by 16k, which in turn
  67.         ** increases the stack by 16k. */
  68.  
  69.     MaxApplZone();                    /* Expand the heap so code segments load at the top. */
  70.  
  71.     Initialize(32, kMinHeap, kMinSpace, nil, nil);    /* Initialize the program. */
  72.     DoSetResCursor(watchCursor);                    /* Rest of startup may take a while. */
  73.     InitRequiredAppleEvents();
  74.     InitWFMTAppleEvents();
  75.     GetWindowFormats();                    /* Get the window definition resource information. */
  76.     ReadPreferences('aprf', gSignature, kPrefFileName);
  77.     DefaultPreferences();
  78.     OpenRuntimeOnlyAutoNewWindows();
  79.     DoOpenApplication();
  80.     DoAdjustMenus();
  81.     StartDocuments();                    /* Open (or print) designated documents for 6.0. */
  82.  
  83.     if(CTEUseTSMTE())
  84.         InitTSMAwareApplication();
  85.  
  86.     UnloadSeg((Ptr)Initialize);        /* Initialize can't be in Main! */
  87.     EventLoop();                    /* Call the main event loop. */
  88.  
  89.     if(CTEUseTSMTE())
  90.         CloseTSMAwareApplication();
  91.  
  92.     WritePreferences();
  93.     ExitToShell();                    /* Quit the application. */
  94. }
  95.  
  96.  
  97.  
  98. /*****************************************************************************/
  99.  
  100.  
  101.  
  102. OSErr    DefaultPreferences(void)
  103. {
  104.     return(noErr);
  105. }
  106.  
  107.  
  108.  
  109.